package com.fengye.school.model.school.enums;

import lombok.Getter;

@Getter
public enum CourseType {

    // 全校通识类课程
    GENERAL_REQUIRED_SUBJECT(0, "全校通识类必修课程"),
    GENERAL_ELECTIVE_SUBJECT(1, "全校通识类选修课程"),
    PROFESSIONAL_REQUIRED_SUBJECT(11, "专业必修课程"),
    PROFESSIONAL_ELECTIVE_SUBJECT(12, "专业选修课程"),

    ;

    private final int code;
    private final String name;

    CourseType(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static CourseType getCourseTypeEnumFromName(String name){
        for (CourseType type: CourseType.values()){
            if (type.name.equals(name)){
                return type;
            }
        }
        return null;
    }
}
